﻿<Window
		xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
		xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
		xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" x:Class="WpfBrushes.MainWindow"
		Title="Wpf Brushes" Height="350" Width="525" Topmost="True">
	<Grid x:Name="rootLayout">
		<Grid.RowDefinitions>
			<RowDefinition Height="Auto"/>
			<RowDefinition/>
		</Grid.RowDefinitions>
		<Grid>
			<Grid.ColumnDefinitions>
				<ColumnDefinition Width="Auto"/>
				<ColumnDefinition/>
			</Grid.ColumnDefinitions>
			<Grid.RowDefinitions>
				<RowDefinition Height="Auto"/>
				<RowDefinition Height="Auto"/>
				<RowDefinition Height="Auto"/>
			</Grid.RowDefinitions>
			<Label Content="Search" HorizontalAlignment="Left" d:LayoutOverrides="Height"/>
			<Label Content="Name" HorizontalAlignment="Left" d:LayoutOverrides="Height" Grid.Row="1"/>
			<Label Content="Hex" HorizontalAlignment="Left" d:LayoutOverrides="Height" Grid.Row="2"/>
			<TextBox Text="{Binding Search, UpdateSourceTrigger=PropertyChanged}" TextWrapping="Wrap" d:LayoutOverrides="Width, Height" Grid.Column="1" Margin="4,4,4,0"/>
			<TextBox Text="{Binding Items.CurrentItem.Name, Mode=OneWay}" TextWrapping="Wrap" d:LayoutOverrides="Width, Height" Grid.Column="1" Grid.Row="1" IsReadOnly="True" Margin="4"/>
			<TextBox Text="{Binding Items.CurrentItem.Hex, Mode=OneWay}" TextWrapping="Wrap" d:LayoutOverrides="Width, Height" Grid.Column="1" Grid.Row="2" IsReadOnly="True" Margin="4,0,4,4"/>
		</Grid>
		<ListBox ItemsSource="{Binding Items}" IsSynchronizedWithCurrentItem="True" ScrollViewer.VerticalScrollBarVisibility="Disabled" Grid.Row="1">
			<ListBox.ItemsPanel>
				<ItemsPanelTemplate>
					<WrapPanel Orientation="Vertical" />
				</ItemsPanelTemplate>
			</ListBox.ItemsPanel>
			<ListBox.ItemTemplate>
				<DataTemplate>
					<StackPanel Width="175" Orientation="Horizontal" Background="Transparent">
                        <StackPanel.ContextMenu>
                            <ContextMenu>
                                <MenuItem Click="OnCopyName" Header="Copy name" />
                                <MenuItem Click="OnCopyHex" Header="Copy hex" />
                            </ContextMenu>
                        </StackPanel.ContextMenu>
						<Rectangle Margin="2,2,5,2" Width="75" Height="20" Stroke="Black" Fill="{Binding Brush}" />
						<TextBlock Text="{Binding Name}" />
					</StackPanel>
				</DataTemplate>
			</ListBox.ItemTemplate>
		</ListBox>
	</Grid>
</Window>
